<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Encoding - RDoc Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0-preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-aliases">::aliases</a>
    <li ><a href="#method-c-compatible-3F">::compatible?</a>
    <li ><a href="#method-c-default_external">::default_external</a>
    <li ><a href="#method-c-default_external-3D">::default_external=</a>
    <li ><a href="#method-c-default_internal">::default_internal</a>
    <li ><a href="#method-c-default_internal-3D">::default_internal=</a>
    <li ><a href="#method-c-find">::find</a>
    <li ><a href="#method-c-list">::list</a>
    <li ><a href="#method-c-locale_charmap">::locale_charmap</a>
    <li ><a href="#method-c-name_list">::name_list</a>
    <li ><a href="#method-i-ascii_compatible-3F">#ascii_compatible?</a>
    <li ><a href="#method-i-dummy-3F">#dummy?</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-name">#name</a>
    <li ><a href="#method-i-names">#names</a>
    <li ><a href="#method-i-to_s">#to_s</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Encoding">
    <h1 id="class-Encoding" class="class">
      class Encoding
    </h1>

    <section class="description">
    
<p>An Encoding instance represents a character encoding usable in Ruby. It is defined as a constant under the Encoding namespace. It has a name and, optionally, aliases:</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">US_ASCII</span>.<span class="ruby-identifier">name</span>  <span class="ruby-comment"># =&gt; &quot;US-ASCII&quot;</span>
<span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">US_ASCII</span>.<span class="ruby-identifier">names</span> <span class="ruby-comment"># =&gt; [&quot;US-ASCII&quot;, &quot;ASCII&quot;, &quot;ANSI_X3.4-1968&quot;, &quot;646&quot;]</span>
</pre>

<p>A Ruby method that accepts an encoding as an argument will accept:</p>
<ul><li>
<p>An Encoding object.</p>
</li><li>
<p>The name of an encoding.</p>
</li><li>
<p>An alias for an encoding name.</p>
</li></ul>

<p>These are equivalent:</p>

<pre class="ruby"><span class="ruby-string">&#39;foo&#39;</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">US_ASCII</span>) <span class="ruby-comment"># Encoding object.</span>
<span class="ruby-string">&#39;foo&#39;</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-string">&#39;US-ASCII&#39;</span>)         <span class="ruby-comment"># Encoding name.</span>
<span class="ruby-string">&#39;foo&#39;</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-string">&#39;ASCII&#39;</span>)            <span class="ruby-comment"># Encoding alias.</span>
</pre>

<p>For a full discussion of encodings and their uses, see <a href="encodings_rdoc.html">the Encodings document</a>.</p>

<p>Encoding::ASCII_8BIT is a special-purpose encoding that is usually used for a string of bytes, not a string of characters. But as the name indicates, its characters in the ASCII range are considered as ASCII characters. This is useful when you use other ASCII-compatible encodings.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-aliases" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          aliases -&gt; {&quot;alias1&quot; =&gt; &quot;orig1&quot;, &quot;alias2&quot; &rarr; &quot;orig2&quot;, ...}
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the hash of available encoding alias and original encoding name.</p>

<pre>Encoding.aliases
#=&gt; {&quot;BINARY&quot;=&gt;&quot;ASCII-8BIT&quot;, &quot;ASCII&quot;=&gt;&quot;US-ASCII&quot;, &quot;ANSI_X3.4-1968&quot;=&gt;&quot;US-ASCII&quot;,
      &quot;SJIS&quot;=&gt;&quot;Windows-31J&quot;, &quot;eucJP&quot;=&gt;&quot;EUC-JP&quot;, &quot;CP932&quot;=&gt;&quot;Windows-31J&quot;}</pre>

                              <div class="method-source-code" id="aliases-source">
            <pre>static VALUE
rb_enc_aliases(VALUE klass)
{
    VALUE aliases[2];
    aliases[0] = rb_hash_new();
    aliases[1] = rb_ary_new();

    st_foreach(global_enc_table.names, rb_enc_aliases_enc_i, (st_data_t)aliases);

    return aliases[0];
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-compatible-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          compatible?(obj1, obj2) &rarr; enc or nil
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Checks the compatibility of two objects.</p>

<p>If the objects are both strings they are compatible when they are concatenatable.  The encoding of the concatenated string will be returned if they are compatible, nil if they are not.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">compatible?</span>(<span class="ruby-string">&quot;\xa1&quot;</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;iso-8859-1&quot;</span>), <span class="ruby-string">&quot;b&quot;</span>)
<span class="ruby-comment">#=&gt; #&lt;Encoding:ISO-8859-1&gt;</span>

<span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">compatible?</span>(
  <span class="ruby-string">&quot;\xa1&quot;</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;iso-8859-1&quot;</span>),
  <span class="ruby-string">&quot;\xa1\xa1&quot;</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;euc-jp&quot;</span>))
<span class="ruby-comment">#=&gt; nil</span>
</pre>

<p>If the objects are non-strings their encodings are compatible when they have an encoding and:</p>
<ul><li>
<p>Either encoding is US-ASCII compatible</p>
</li><li>
<p>One of the encodings is a 7-bit encoding</p>
</li></ul>

                              <div class="method-source-code" id="compatible-3F-source">
            <pre>static VALUE
enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
{
    rb_encoding *enc;

    if (!enc_capable(str1)) return Qnil;
    if (!enc_capable(str2)) return Qnil;
    enc = rb_enc_compatible(str1, str2);
    if (!enc) return Qnil;
    return rb_enc_from_encoding(enc);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_external" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          default_external &rarr; enc
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns default external encoding.</p>

<p>The default external encoding is used by default for strings created from the following locations:</p>
<ul><li>
<p>CSV</p>
</li><li>
<p><a href="File.html"><code>File</code></a> data read from disk</p>
</li><li>
<p>SDBM</p>
</li><li>
<p>StringIO</p>
</li><li>
<p>Zlib::GzipReader</p>
</li><li>
<p>Zlib::GzipWriter</p>
</li><li>
<p><a href="String.html#method-i-inspect"><code>String#inspect</code></a></p>
</li><li>
<p><a href="Regexp.html#method-i-inspect"><code>Regexp#inspect</code></a></p>
</li></ul>

<p>While strings created from these locations will have this encoding, the encoding may not be valid.  Be sure to check <a href="String.html#method-i-valid_encoding-3F"><code>String#valid_encoding?</code></a>.</p>

<p><a href="File.html"><code>File</code></a> data written to disk will be transcoded to the default external encoding when written, if <a href="Encoding.html#method-c-default_internal"><code>default_internal</code></a> is not nil.</p>

<p>The default external encoding is initialized by the -E option. If -E isn’t set, it is initialized to UTF-8 on Windows and the locale on other operating systems.</p>

                              <div class="method-source-code" id="default_external-source">
            <pre>static VALUE
get_default_external(VALUE klass)
{
    return rb_enc_default_external();
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_external-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          default_external = enc
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets default external encoding.  You should not set <a href="Encoding.html#method-c-default_external"><code>Encoding::default_external</code></a> in ruby code as strings created before changing the value may have a different encoding from strings created after the value was changed., instead you should use <code>ruby -E</code> to invoke ruby with the correct default_external.</p>

<p>See <a href="Encoding.html#method-c-default_external"><code>Encoding::default_external</code></a> for information on how the default external encoding is used.</p>

                              <div class="method-source-code" id="default_external-3D-source">
            <pre>static VALUE
set_default_external(VALUE klass, VALUE encoding)
{
    rb_warning(&quot;setting Encoding.default_external&quot;);
    rb_enc_set_default_external(encoding);
    return encoding;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_internal" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          default_internal &rarr; enc
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns default internal encoding.  Strings will be transcoded to the default internal encoding in the following places if the default internal encoding is not nil:</p>
<ul><li>
<p>CSV</p>
</li><li>
<p>Etc.sysconfdir and Etc.systmpdir</p>
</li><li>
<p><a href="File.html"><code>File</code></a> data read from disk</p>
</li><li>
<p><a href="File.html"><code>File</code></a> names from <a href="Dir.html"><code>Dir</code></a></p>
</li><li>
<p><a href="Integer.html#method-i-chr"><code>Integer#chr</code></a></p>
</li><li>
<p><a href="String.html#method-i-inspect"><code>String#inspect</code></a> and <a href="Regexp.html#method-i-inspect"><code>Regexp#inspect</code></a></p>
</li><li>
<p>Strings returned from Readline</p>
</li><li>
<p>Strings returned from SDBM</p>
</li><li>
<p><a href="Time.html#method-i-zone"><code>Time#zone</code></a></p>
</li><li>
<p>Values from <a href="ENV.html"><code>ENV</code></a></p>
</li><li>
<p>Values in ARGV including $PROGRAM_NAME</p>
</li></ul>

<p>Additionally <a href="String.html#method-i-encode"><code>String#encode</code></a> and <a href="String.html#method-i-encode-21"><code>String#encode!</code></a> use the default internal encoding if no encoding is given.</p>

<p>The script encoding (__ENCODING__), not <a href="Encoding.html#method-c-default_internal"><code>default_internal</code></a>, is used as the encoding of created strings.</p>

<p><a href="Encoding.html#method-c-default_internal"><code>Encoding::default_internal</code></a> is initialized with -E option or nil otherwise.</p>

                              <div class="method-source-code" id="default_internal-source">
            <pre>static VALUE
get_default_internal(VALUE klass)
{
    return rb_enc_default_internal();
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_internal-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          default_internal = enc or nil
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets default internal encoding or removes default internal encoding when passed nil.  You should not set <a href="Encoding.html#method-c-default_internal"><code>Encoding::default_internal</code></a> in ruby code as strings created before changing the value may have a different encoding from strings created after the change.  Instead you should use <code>ruby -E</code> to invoke ruby with the correct default_internal.</p>

<p>See <a href="Encoding.html#method-c-default_internal"><code>Encoding::default_internal</code></a> for information on how the default internal encoding is used.</p>

                              <div class="method-source-code" id="default_internal-3D-source">
            <pre>static VALUE
set_default_internal(VALUE klass, VALUE encoding)
{
    rb_warning(&quot;setting Encoding.default_internal&quot;);
    rb_enc_set_default_internal(encoding);
    return encoding;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-find" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          find(string) &rarr; enc
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Search the encoding with specified <em>name</em>. <em>name</em> should be a string.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">find</span>(<span class="ruby-string">&quot;US-ASCII&quot;</span>)  <span class="ruby-comment">#=&gt; #&lt;Encoding:US-ASCII&gt;</span>
</pre>

<p>Names which this method accept are encoding names and aliases including following special aliases</p>
<dl class="rdoc-list note-list"><dt>“external”
<dd>
<p>default external encoding</p>
</dd><dt>“internal”
<dd>
<p>default internal encoding</p>
</dd><dt>“locale”
<dd>
<p>locale encoding</p>
</dd><dt>“filesystem”
<dd>
<p>filesystem encoding</p>
</dd></dl>

<p>An <a href="ArgumentError.html"><code>ArgumentError</code></a> is raised when no encoding with <em>name</em>. Only <code>Encoding.find(&quot;internal&quot;)</code> however returns nil when no encoding named “internal”, in other words, when Ruby has no default internal encoding.</p>

                              <div class="method-source-code" id="find-source">
            <pre>static VALUE
enc_find(VALUE klass, VALUE enc)
{
    int idx;
    if (is_obj_encoding(enc))
        return enc;
    idx = str_to_encindex(enc);
    if (idx == UNSPECIFIED_ENCODING) return Qnil;
    return rb_enc_from_encoding_index(idx);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-list" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          list &rarr; [enc1, enc2, ...]
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the list of loaded encodings.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">list</span>
<span class="ruby-comment">#=&gt; [#&lt;Encoding:ASCII-8BIT&gt;, #&lt;Encoding:UTF-8&gt;,</span>
      <span class="ruby-comment">#&lt;Encoding:ISO-2022-JP (dummy)&gt;]</span>

<span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">find</span>(<span class="ruby-string">&quot;US-ASCII&quot;</span>)
<span class="ruby-comment">#=&gt; #&lt;Encoding:US-ASCII&gt;</span>

<span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">list</span>
<span class="ruby-comment">#=&gt; [#&lt;Encoding:ASCII-8BIT&gt;, #&lt;Encoding:UTF-8&gt;,</span>
      <span class="ruby-comment">#&lt;Encoding:US-ASCII&gt;, #&lt;Encoding:ISO-2022-JP (dummy)&gt;]</span>
</pre>

                              <div class="method-source-code" id="list-source">
            <pre>static VALUE
enc_list(VALUE klass)
{
    VALUE ary = rb_ary_new2(0);
    rb_ary_replace(ary, rb_encoding_list);
    return ary;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-locale_charmap" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          locale_charmap &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the locale charmap name. It returns nil if no appropriate information.</p>

<pre class="ruby"><span class="ruby-constant">Debian</span> <span class="ruby-constant">GNU</span><span class="ruby-operator">/</span><span class="ruby-constant">Linux</span>
  <span class="ruby-constant">LANG</span>=<span class="ruby-constant">C</span>
    <span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">locale_charmap</span>  <span class="ruby-comment">#=&gt; &quot;ANSI_X3.4-1968&quot;</span>
  <span class="ruby-constant">LANG</span>=<span class="ruby-identifier">ja_JP</span>.<span class="ruby-constant">EUC</span><span class="ruby-operator">-</span><span class="ruby-constant">JP</span>
    <span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">locale_charmap</span>  <span class="ruby-comment">#=&gt; &quot;EUC-JP&quot;</span>

<span class="ruby-constant">SunOS</span> <span class="ruby-value">5</span>
  <span class="ruby-constant">LANG</span>=<span class="ruby-constant">C</span>
    <span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">locale_charmap</span>  <span class="ruby-comment">#=&gt; &quot;646&quot;</span>
  <span class="ruby-constant">LANG</span>=<span class="ruby-identifier">ja</span>
    <span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">locale_charmap</span>  <span class="ruby-comment">#=&gt; &quot;eucJP&quot;</span>
</pre>

<p>The result is highly platform dependent. So <a href="Encoding.html#method-c-find"><code>Encoding.find(Encoding.locale_charmap)</code></a> may cause an error. If you need some encoding object even for unknown locale, <a href="Encoding.html#method-c-find"><code>Encoding.find</code></a>(“locale”) can be used.</p>

                              <div class="method-source-code" id="locale_charmap-source">
            <pre>VALUE
rb_locale_charmap(VALUE klass)
{
#if NO_LOCALE_CHARMAP
    return rb_usascii_str_new_cstr(&quot;US-ASCII&quot;);
#else
    return locale_charmap(rb_usascii_str_new_cstr);
#endif
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-name_list" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          name_list &rarr; [&quot;enc1&quot;, &quot;enc2&quot;, ...]
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the list of available encoding names.</p>

<pre>Encoding.name_list
#=&gt; [&quot;US-ASCII&quot;, &quot;ASCII-8BIT&quot;, &quot;UTF-8&quot;,
      &quot;ISO-8859-1&quot;, &quot;Shift_JIS&quot;, &quot;EUC-JP&quot;,
      &quot;Windows-31J&quot;,
      &quot;BINARY&quot;, &quot;CP932&quot;, &quot;eucJP&quot;]</pre>

                              <div class="method-source-code" id="name_list-source">
            <pre>static VALUE
rb_enc_name_list(VALUE klass)
{
    VALUE ary = rb_ary_new2(global_enc_table.names-&gt;num_entries);
    st_foreach(global_enc_table.names, rb_enc_name_list_i, (st_data_t)ary);
    return ary;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-ascii_compatible-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          ascii_compatible? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns whether ASCII-compatible or not.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">UTF_8</span>.<span class="ruby-identifier">ascii_compatible?</span>     <span class="ruby-comment">#=&gt; true</span>
<span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">UTF_16BE</span>.<span class="ruby-identifier">ascii_compatible?</span>  <span class="ruby-comment">#=&gt; false</span>
</pre>

                              <div class="method-source-code" id="ascii_compatible-3F-source">
            <pre>static VALUE
enc_ascii_compatible_p(VALUE enc)
{
    return RBOOL(rb_enc_asciicompat(must_encoding(enc)));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-dummy-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          dummy? &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns true for dummy encodings. A dummy encoding is an encoding for which character handling is not properly implemented. It is used for stateful encodings.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">ISO_2022_JP</span>.<span class="ruby-identifier">dummy?</span>       <span class="ruby-comment">#=&gt; true</span>
<span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">UTF_8</span>.<span class="ruby-identifier">dummy?</span>             <span class="ruby-comment">#=&gt; false</span>
</pre>

                              <div class="method-source-code" id="dummy-3F-source">
            <pre>static VALUE
enc_dummy_p(VALUE enc)
{
    return RBOOL(ENC_DUMMY_P(must_encoding(enc)));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          inspect &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a string which represents the encoding for programmers.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">UTF_8</span>.<span class="ruby-identifier">inspect</span>       <span class="ruby-comment">#=&gt; &quot;#&lt;Encoding:UTF-8&gt;&quot;</span>
<span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">ISO_2022_JP</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-comment">#=&gt; &quot;#&lt;Encoding:ISO-2022-JP (dummy)&gt;&quot;</span>
</pre>

                              <div class="method-source-code" id="inspect-source">
            <pre>static VALUE
enc_inspect(VALUE self)
{
    rb_encoding *enc;

    if (!is_data_encoding(self)) {
        not_encoding(self);
    }
    if (!(enc = DATA_PTR(self)) || rb_enc_from_index(rb_enc_to_index(enc)) != enc) {
        rb_raise(rb_eTypeError, &quot;broken Encoding&quot;);
    }
    return rb_enc_sprintf(rb_usascii_encoding(),
                          &quot;#&lt;%&quot;PRIsVALUE&quot;:%s%s%s&gt;&quot;, rb_obj_class(self),
                          rb_enc_name(enc),
                          (ENC_DUMMY_P(enc) ? &quot; (dummy)&quot; : &quot;&quot;),
                          rb_enc_autoload_p(enc) ? &quot; (autoload)&quot; : &quot;&quot;);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-name" class="method-detail method-alias">
                      <div class="method-heading">
                        <span class="method-callseq">
                          name &rarr; string
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns the name of the encoding.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">UTF_8</span>.<span class="ruby-identifier">name</span>      <span class="ruby-comment">#=&gt; &quot;UTF-8&quot;</span>
</pre>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Encoding.html#method-i-to_s">to_s</a>
                            </div>
                          </div>

                  <div id="method-i-names" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          names &rarr; array
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the list of name and aliases of the encoding.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">WINDOWS_31J</span>.<span class="ruby-identifier">names</span>  <span class="ruby-comment">#=&gt; [&quot;Windows-31J&quot;, &quot;CP932&quot;, &quot;csWindows31J&quot;, &quot;SJIS&quot;, &quot;PCK&quot;]</span>
</pre>

                              <div class="method-source-code" id="names-source">
            <pre>static VALUE
enc_names(VALUE self)
{
    VALUE args[2];

    args[0] = (VALUE)rb_to_encoding_index(self);
    args[1] = rb_ary_new2(0);
    st_foreach(global_enc_table.names, enc_names_i, (st_data_t)args);
    return args[1];
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_s &rarr; string
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the name of the encoding.</p>

<pre class="ruby"><span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">UTF_8</span>.<span class="ruby-identifier">name</span>      <span class="ruby-comment">#=&gt; &quot;UTF-8&quot;</span>
</pre>

                              <div class="method-source-code" id="to_s-source">
            <pre>static VALUE
enc_name(VALUE self)
{
    return rb_fstring_cstr(rb_enc_name((rb_encoding*)DATA_PTR(self)));
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Encoding.html#method-i-name">name</a>
                            </div>

                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

